package com.tongji.housediy.view.titlewindows
{
	import com.tongji.housediy.utils.PopUpAdmin;
	
	import flash.events.MouseEvent;
	
	import mx.managers.PopUpManager;
	
	import org.robotlegs.base.MediatorMap;
	import org.robotlegs.mvcs.Mediator;
	
	public class NotLoginTitleWinMediator extends Mediator
	{
		[Inject]
		public var view:NotLoginTitleWindow;
		
		public function NotLoginTitleWinMediator()
		{
			super();
		}
		public override function onRegister():void
		{
			view.cancelBtn.addEventListener(MouseEvent.CLICK,cancelBtnClickHandler);
			view.closeBtn.addEventListener(MouseEvent.CLICK,closeBtnClickHandler);
			view.loginBtn.addEventListener(MouseEvent.CLICK,loginBtnClickHandler);
			view.registerBtn.addEventListener(MouseEvent.CLICK,registerBtnClickHandler);
		}
		
		private function cancelBtnClickHandler(event:MouseEvent):void
		{
			PopUpManager.removePopUp(view);
		}
		
		private function closeBtnClickHandler(event:MouseEvent):void
		{
			PopUpManager.removePopUp(view);
		}
		
		private function registerBtnClickHandler(event:MouseEvent):void
		{
			PopUpAdmin.popupCenterWindow("userRegister",view.parent,mediatorMap);
			PopUpManager.removePopUp(view);
		}
		
		private function loginBtnClickHandler(event:MouseEvent):void
		{
			var saveWindow:LoginTitleWindow = new LoginTitleWindow();
			saveWindow.name = "save";
			PopUpManager.addPopUp(saveWindow, view.parent, true);
			PopUpManager.centerPopUp(saveWindow);
			mediatorMap.createMediator(saveWindow);
			PopUpManager.removePopUp(view);
		}
		
	}
	
}